<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Category_model extends CI_Model{
	public function ___construct(){
		parent::__construct();
		$data=array();
	
	}
	public function create_user_type($insert){
		$this->db->insert('user_type',$insert);
	}
	
	public function create_department($insert){
		$this->db->insert('department',$insert);
	}
	public function insert($name,$description,$additional_data){
		$data= array(
		'name' => $name,
		'description' => $description);
		$this->db->insert('category_table',$data);
	}
	public function get_category(){	
		$query = $this->db->get('category_table');
		return $query;
	}
	public function edit_category($id){
		$query = $this->db->get_where('category_table', array('id' => $id));
		return $query;
	}
	public function update($edit_id, $data){
		$this->db->update('category_table',$data,array('id'=>$edit_id));
	}
	public function delete($id){
		$this->db->delete('category_table',array('id'=>$id));		
	}
	public function get(){
	   $this->datatables
			->select("id,name,description")
			->from("category_table")		
			->add_column("Actions", 
			"<center>			<a href='edit_category/$1' title='Edit Category'>
								<i class='icon-edit'></i>
								</a>&nbsp;&nbsp;
							    <a href='delete_category/$1' title='Delete Category' onClick=\"return confirm('". 'Do U Want To Delete Category! ' ."')\">
								<i class='icon-trash'></i>
								</a></center>", "id")
			->unset_column('id');
		
	   return  $this->datatables->generate();
	
}
}

?>